<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Class</title>
    <link rel="stylesheet" href="./css/normalize.css">
    <link rel="stylesheet" href="./css/main.css" >
    <script type="text/javascript" src="./js/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="./js/jquery-ui-1.10.4.custom.min.js"></script>
    <script type="text/javascript" src="./js/modernizr.custom.68273.js"></script>
</head>
<body>
<div class="container">
    <div class="main-left">
    <div class="main-right">
        <div class="main">
            <div class="nav">
                <ul>
                    <li>
                        <a id="tab" href="#">Classes</a>
                        <span class="courses-button">▼</span>
                        <ul class="courses-dd" id="tab">
                            <li><a href="#">Software Engineering</a></li>
                            <li><a href="#">Operating Systems</a></li>
                        </ul>
                    </li>
                    <li><a href="#">Schedule</a></li>
                    <li><a href="#">Help</a></li>
                </ul>
            </div><!-- nav end-->
            
            <div class="content">
                <div class="offset">
                    <div class="left">
                        <table class="crumbs">
                            <tbody>
                                <tr>
                                    <!-- change java code here -->
                                    <td class="first">
                                        <a href="#">
                                            Classes
                                        </a>
                                    </td>
                                    <td>→</td>
                                    <td class="first"><a href="#">Software Engineering</a></td>
                                    <td>→</td>
                                    <td class="last"><em>3B-04</em></td>
                                </tr>
                            </tbody>
                        </table>
                        <div class="page-left">
                            <h2 class="feed-header">
                                <span class="course-name round-5" href="#">Software Engineering</span>
                                3B-04 group
                            </h2>
                            <div class="export-att">
                                <button class="export-att-button" id="export-att">
                                    <span>
                                        Export Attendance
                                    </span>
                                </button>
                            </div>
                            <div class="prev-date">
                                <button class="prev nohover" id="prev-date">Previous dates</button>
                                <button class="next" id="next-date">Next dates</button>
                            </div>
                            <div class="clear"></div>
                            <table class="student-list">
                                <thead>
                                    <tr>
                                        <th>Student name</th>
                                        <th data-col="0">14.04</th>
                                        <th >15.04</th>
                                        <th>16.04</th>
                                        <th>17.04</th>
                                        <th>18.04</th>
                                    </td>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td class="student-name">
                                            Adilbek Zhaxalykov
                                        </td>
                                        <td class="student-att" data-col="0">
                                            1
                                        </td>
                                        <td class="student-att">
                                            1
                                        </td>
                                        <td class="student-att">
                                            1
                                        </td>
                                        <td class="student-att">
                                            2
                                        </td>
                                        <td class="student-att">
                                            1
                                        </td>
                                        <div class="clear"></div>
                                    </tr>
                                    <tr>
                                        <td class="student-name">
                                            Vasya Pupkin
                                        </td>
                                        <td class="student-att" data-col="0">
                                            1
                                        </td>
                                        <td class="student-att">
                                            1
                                        </td>
                                        <td class="student-att">
                                            2
                                        </td>
                                        <td class="student-att">
                                            2
                                        </td>
                                        <td class="student-att">
                                            1
                                        </td>
                                        <div class="clear"></div>
                                    </tr>
                                    <tr>
                                        <td class="student-name">
                                            Nursultan Nazarbayev
                                        </td>
                                        <td class="student-att" data-col="0">
                                            1
                                        </td>
                                        <td class="student-att">
                                            0
                                        </td>
                                        <td class="student-att">
                                            1
                                        </td>
                                        <td class="student-att">
                                            1
                                        </td>
                                        <td class="student-att">
                                            1
                                        </td>
                                        <div class="clear"></div>
                                    </tr>
                                </tbody>
                            </table>
                            <div class="clear"></div>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="right">
                    <div class="right-fade">
                        <div class="right-time">
                            <span class="time round-3">
                                Monday, Apr 14th, 
                                <abbr id="current-time">10:14am</abbr>
                            </span>
                        </div>
                        <div class="right-classes">
                            <h2>Your classes</h2>
                            <ul class="courses_ul">
                                <li class="course_li" id="course_123123">
                                    <a id="course_123123" class="course" href="#">
                                    Software Engineering
                                    </a>
                                </li>
                                <li class="course_li" id="course_123123">
                                    <a id="course_123123" class="course" href="#">
                                    Operating Systems
                                    </a>
                                </li>
                            </ul>
                            <a href="#">Add a class</a>
                        </div>
                        <div class="clear"></div>
                        <div class="right-extras">
                            <h2>Support</h2>
                        </div>
                    </div>
                </div>
                <div class="clear"></div>
            </div>

        </div>
        <div class="clear"></div>
    </div>
    </div>
    <div class="clear"></div>
</div><!-- container end-->
<div class="clear"></div>
<script src="./js/jquery-main.js"></script>
<script src="./js/jquery-calendar.js"></script>
<script>
$(document).ready(function() {

    function changeColor(t, grade) {
        if (t.hasClass("yellow"))
            t.removeClass("yellow");
        if (t.hasClass("green"))
            t.removeClass("green");
        switch (grade) {
            case 1: t.addClass("yellow"); break;
            case 2: t.addClass("green"); break;
        }
    }

    $(".student-list td").each(function() {
        var t = $(this);
        if ($.isNumeric(t.text())) {
            var grade = parseInt(t.text());
            changeColor(t, grade);
            //t.text("");
        }
    });
    $(".student-list td").click(function(ev) {
        ev.preventDefault();
        var t = $(this);
        if (t.hasClass("student-att")) {
            var grade = parseInt(t.text());
            if (grade == 2)
                grade = 0;
            else 
                grade++;
            changeColor(t, grade);
            t.text(grade);
        }
        // maybe ajax here
        return false;
    });
    $("#prev-date").click(function() {
        var t = $(this);
        if (true) {
            t.removeClass("nohover");
        }
        if (t.hasClass("nohover")) {
            return false;
        }
        return false;
    });

});
</script>
</body>
</html>